package SFT;
/** Used to represent a function that is a difference between two functions:
 * func on the segment represented by pair1, and func on the segment represented by pair2*/
public class diffFunc extends abstractFunction{
	
	int maxval;
	Function func;
	Pair pair1;
	Pair pair2;
	
	public diffFunc(Pair candidate, Pair pair, Function func) {
		this.maxval=candidate.length()-1;
		this.func=func;
		this.pair1=candidate;
		this.pair2=pair;
	}


	@Override
	public Complex apply(int i) {
		return Complex.Sub(func.apply(pair1.car()+i), func.apply(pair2.car()+i));
	}


	@Override
	public int maxVal() {
		return maxval;
	}


}
